package com.xxtx.trade.web.userCenter;

import com.xxtx.trade.common.util.model.Result;
import com.xxtx.trade.sysUser.dto.TradeSysMenuDto;
import com.xxtx.trade.sysUser.service.TradeSysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/xxtx/sysMenu")
public class SysMenuController {

    @Autowired
    private TradeSysMenuService tradeSysMenuService;

    /**
     * 根据用户id 去拿菜单
     */
    @RequestMapping(value = "/user/menu",method = RequestMethod.POST)
   public Result selectMenuByUserId(@RequestBody TradeSysMenuDto dto){
        return  tradeSysMenuService.selectUserMenus(dto);
    }
    /**
     * 创建菜单
     */
    @RequestMapping(value = "/create/menu",method = RequestMethod.POST)
   public Result create(@RequestBody TradeSysMenuDto dto){
        return  tradeSysMenuService.createMenus(dto);
    }
    /**
     * 查询所有菜单（传角色id  就是看是否选中）
     */
    @RequestMapping(value = "/check/menu",method = RequestMethod.POST)
   public Result selectAllMenus(@RequestBody TradeSysMenuDto dto){
        return  tradeSysMenuService.selectAllMenus(dto);
    }
    /**
     * 据id删除菜单
     */
    @RequestMapping(value = "/delete/menu",method = RequestMethod.POST)
   public Result delete(@RequestBody TradeSysMenuDto dto){
        return  tradeSysMenuService.delectMenus(dto);
    }
    /**
     * 根据用户id 去拿菜单
     */
    @RequestMapping(value = "/update/menu",method = RequestMethod.POST)
   public Result update(@RequestBody TradeSysMenuDto dto){
        return  tradeSysMenuService.updateMenus(dto);
    }
}
